package com.itheima.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.common.PageBean;
import com.itheima.dto.OperateLogDto;
import com.itheima.mapper.OperateLogMapper;
import com.itheima.service.OperateLogService;
import com.itheima.vo.OperateLogVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OperateLogServiceImpl implements OperateLogService {
    @Autowired
    private OperateLogMapper operateLogMapper;
    @Override
    public PageBean pageQuery(OperateLogDto dto) {
        PageHelper.startPage(dto.getPage(), dto.getPageSize());
        Page<OperateLogVo> page = operateLogMapper.query(dto);
        long total = page.getTotal();
        List<OperateLogVo> list = page.getResult();
        return new PageBean(total, list);
    }
}
